-- IS_HOLY_ITEMS_UPGRADE_SUCC

-- 判断圣器的基本属性是否升级成功
-- @param user     玩家对象
-- @parma classId  待升级的装备编号
return function(user, classId)
    local dbase = HolyItemsM.query(classId, "dbase");
    local succRatio;

    if type(dbase["succ_ratio"]) == "number" then
        succRatio = dbase["succ_ratio"];
    else
        -- 当前已失败次数
        local failTimes = HolyItemsM.getFailTimes(classId);

        local toLevel = HolyItemsM.getBaseLevel(classId) + 1;

        -- 每个等级保护次数
        local protectTimesMap = { 1, 1, 1, 1, 2, 2, 2, 3, 3, 3};
        if failTimes >= protectTimesMap[toLevel] then
            return true;
        end

        local succRatioMap = { 100, 100, 100, 100, 75, 70, 65, 55, 50, 45, };
        succRatio = succRatioMap[toLevel];
    end

    local seed = DungeonM.getRandSeed("IS_HOLY_ITEMS_UPGRADE_SUCC");
    if seed % 100 < succRatio then
        return true;
    end

    return false;
end